#include<stdio.h>

int main()
{
	int n;
	int i,j;
	int x=0,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		j=i;
		while(j)
		{
			x=j%10;
			sum+=x;
			j=j/10;
		}
	}
	printf("%d\n",sum);
	return 0;
 } 
